package cc.dullsky.user;

import com.jfinal.core.Controller;
import com.jfinal.kit.HashKit;

import cc.dullsky.common.model.User;

public class UserController extends Controller {
	public void login() {
		String username = getPara("username");
		String md5Password = HashKit.md5(getPara("password"));
		User user = User.dao.login(username, md5Password);
		if (user != null) {
			setSessionAttr("user", user);
			redirect("/admin");
		} else {
			redirect("/login");
		}
	}
}
